package danny.hoi.service.export.system.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import danny.hoi.dao.export.system.SysLogDao;
import danny.hoi.domain.export.system.SysLog;
import danny.hoi.domain.export.system.SysLogExample;
import danny.hoi.service.export.system.SysLogService;
import danny.hoi.utils.UUUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysLogServiceImpl implements SysLogService {
    @Autowired
    private SysLogDao sysLogDao;

    @Override
    public PageInfo<SysLog> findByPages(SysLogExample example, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<SysLog> sysLogs = sysLogDao.selectByExample(example);
        return new PageInfo<>(sysLogs);
    }

    @Override
    public void save(SysLog sysLog) {
        sysLog.setId(UUUIDUtil.getUuid());
        sysLogDao.insertSelective(sysLog);
    }

}
